package com.ityueqiangu.portal.conroller;

import com.ityueqiangu.core.util.ServletUtils;
import com.ityueqiangu.core.util.UserUtil;
import com.ityueqiangu.core.web.controller.BaseController;
import com.ityueqiangu.core.web.result.DataGridResultInfo;
import com.ityueqiangu.project.galleryappoint.domain.GalleryAppoint;
import com.ityueqiangu.project.galleryappoint.service.IGalleryAppointService;
import com.ityueqiangu.project.gallerycomment.domain.ExhibitionComment;
import com.ityueqiangu.project.gallerycomment.service.IExhibitionCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author Clever、xia
 * @title: FrontAppointControl
 * @projectName art-exhibition-system
 * @description:
 * @date 2021-03-18 21:31
 */
@Controller
@RequestMapping(value = "/user/center")
public class FrontAppointControl extends BaseController {

    @Autowired
    private IGalleryAppointService galleryAppointService;

    @Autowired
    private IExhibitionCommentService exhibitionCommentService;

    /**
     * 分页列表查询
     * @param galleryAppoint
     * @return 返回DataGridResultInfo
     */
    @RequestMapping("/galleryAppointList")
    @ResponseBody
    public DataGridResultInfo galleryAppointList(GalleryAppoint galleryAppoint) {
        startPage();
        galleryAppoint.setAppointUserId(UserUtil.getCurrentUser(ServletUtils.getRequest()).getId());
        List<GalleryAppoint> list = galleryAppointService.selectGalleryAppointList(galleryAppoint);
        return getDataTable(list);
    }

    /**
     * 分页列表查询
     * @param
     * @return 返回DataGridResultInfo
     */
    @RequestMapping("/gallerycommentList")
    @ResponseBody
    public DataGridResultInfo gallerycommentList(ExhibitionComment exhibitionComment) {
        startPage();
        exhibitionComment.setCommentUserId(UserUtil.getCurrentUser(ServletUtils.getRequest()).getId());
        List<ExhibitionComment> list = exhibitionCommentService.selectExhibitionCommentList(exhibitionComment);
        return getDataTable(list);
    }
}
